/* << fastinsert report library >> IPhysicFormat.h Oct 31, 2010
 *
 * 	http://code.google.com/p/libfir
 *
 * Copyright (c) 2005 Pavlo Drobov (drobov.pavel@gmail.com)
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 */


#ifndef IPHYSICFORMAT_H_
#define IPHYSICFORMAT_H_

#include "win32_export_macros.h"
#include "IGrid.h"

namespace dasco
{
namespace report
{

//! \struct IConnect
//! \brief interface for universal connect info for remote source (RDBMS etc.)
struct DLL_EXPORT IConnect
{
	virtual ~IConnect(){};
	virtual const char * getLogin() const = 0;
	virtual const char * getPassword() const = 0;
	virtual const char * getDB() const = 0;
};

typedef int errorNumber;

//! \class IIOException
//! \brief interface Exception
class DLL_EXPORT IIOException
{
public:
	IIOException(errorNumber errorNumber = 0)
		:number(errorNumber)
	{}

	operator errorNumber () const {return number;}
	errorNumber number;
};

//! \class IPhysicFormat
//! \brief interface for physic format document
class DLL_EXPORT IPhysicFormat
{
public:
	virtual ~IPhysicFormat(){}

	virtual void renderGrid(const IGrid*) = 0;
	virtual void save(const char*) throw (IIOException) = 0;
	virtual void load(const char*,IGrid***,unsigned*) throw (IIOException) = 0;

	virtual void free(IGrid** g,unsigned qnt)
	{
		if(!g) return;

		for(unsigned i=0; i< qnt;++i)
		{
			if(g[i])
				delete g[i];
		}
		delete [] g;
	}


	virtual void connect(const IConnect*) throw (IIOException) {}
};

}} //end namespace dasco::report

#endif /* IPHYSICFORMAT_H_ */


/*! \mainpage The fastinsert report library (FIR) project
 *
 * 	\image html	logo.gif
 *
 *	\section s_author Author
 *	<p>FIR is developed by <a href="mailto:pavel.drobov@gmail.com">Pavlo Drobov</a>
 *
 *  \section s_license License MIT
 *
 * <p>Copyright (c) 2005 Pavlo Drobov (drobov.pavel@gmail.com)
 *
 * <p>Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *  * 	<p>This software may be used under the terms of proprietary license or GNU General Public
 * 	License version 2.0 as published by the Free Software Foundation
 * 	and appearing in the file LICENSE.GPL included in the packaging of
 * 	this file.
 *
 *
 *	\section s_download Download
 *	get FIR software <a href=http://code.google.com/p/libfir>project page</a>
 *
 *	\section s_intro Introduction
 *	FIR is C++ native library for read/write a GRID report
 *	<p>Feature:
 *		- multi grid PDF file with outline, write only
 *		- multi grid Excel file read/write (ALFA CODE!)
 *		- OCI client for Oracle RDBMS read only
 *
 * \section s_changelog ChangeLog
 * \include ChangeLog.txt
 *
 * \defgroup oracle_group oracle  modules
 *
 */


